import { request } from '../request';


/** get user list */
export function fetchGetUsers(params?: Api.SystemManage.UserSearchParams) {
  return request<Api.SystemManage.UserList>({
    url: '/user-list/users',
    method: 'get',
    params
  });
}

/** add user */
export function fetchAddUsers(data?: Api.SystemManage.UserAddParams) {
  return request<Api.SystemManage.UserList, 'json'>({
    url: '/user-list/users',
    method: 'post',
    data
  });
}

/** delete user */
export function fetchDeleteUsers(data?: Api.SystemManage.CommonDeleteParams) {
  return request<Api.SystemManage.UserList>({
    url: `/user-list/users/${data?.id}`,
    method: 'delete'
  });
}

export function fetchBatchDeleteUsers(data?: Api.SystemManage.CommonBatchDeleteParams) {
  return request<Api.SystemManage.UserList>({
    url: '/user-list/users',
    method: 'delete',
    params: { ids: data?.ids.join(',') }
  });
}
/** update user */
export function fetchUpdateUsers(data?: Api.SystemManage.UserUpdateParams) {
  return request<Api.SystemManage.UserList, 'json'>({
    url: `/user-list/users/${data?.id}`,
    method: 'patch',
    data
  });
}
